Integrand size = 28, antiderivative size = 75 \[ \int \frac {(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx=\frac {\left (c^2-2 i c d+d^2\right ) x}{2 a}+\frac {i d^2 \log (\cos (e+f x))}{a f}+\frac {i (c+i d)^2}{2 f (a+i a \tan (e+f x))} \]
[Out]
Time = 0.10 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.071, Rules used = {3621, 3556} \[ \int \frac {(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx=\frac {x \left (c^2-2 i c d+d^2\right )}{2 a}+\frac {i (c+i d)^2}{2 f (a+i a \tan (e+f x))}+\frac {i d^2 \log (\cos (e+f x))}{a f} \]
[In]
[Out]
Rule 3556
Rule 3621
Rubi steps \begin{align*} \text {integral}& = \frac {i (c+i d)^2}{2 f (a+i a \tan (e+f x))}+\frac {\int \left (a \left (c^2-2 i c d+d^2\right )-2 i a d^2 \tan (e+f x)\right ) \, dx}{2 a^2} \\ & = \frac {\left (c^2-2 i c d+d^2\right ) x}{2 a}+\frac {i (c+i d)^2}{2 f (a+i a \tan (e+f x))}-\frac {\left (i d^2\right ) \int \tan (e+f x) \, dx}{a} \\ & = \frac {\left (c^2-2 i c d+d^2\right ) x}{2 a}+\frac {i d^2 \log (\cos (e+f x))}{a f}+\frac {i (c+i d)^2}{2 f (a+i a \tan (e+f x))} \\ \end{align*}
Time = 1.56 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.91 \[ \int \frac {(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx=-\frac {i \left ((c+i d) \left (\left (c^2-2 i c d+3 d^2\right ) \log (i-\tan (e+f x))-(c-i d)^2 \log (i+\tan (e+f x))\right )+2 d^2 (-3 i c+d) \tan (e+f x)-2 i d^3 \tan ^2(e+f x)+\frac {2 i (c+d \tan (e+f x))^3}{-i+\tan (e+f x)}\right )}{4 a (c+i d) f} \]
[In]
[Out]
Time = 0.35 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.68
method | result | size |
risch | \(-\frac {i x c d}{a}+\frac {c^{2} x}{2 a}+\frac {3 x \,d^{2}}{2 a}-\frac {{\mathrm e}^{-2 i \left (f x +e \right )} c d}{2 a f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} c^{2}}{4 a f}-\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} d^{2}}{4 a f}+\frac {2 d^{2} e}{a f}+\frac {i d^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{a f}\) | \(126\) |
derivativedivides | \(-\frac {i c d \arctan \left (\tan \left (f x +e \right )\right )}{f a}+\frac {c^{2} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}-\frac {i d^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f a}+\frac {d^{2} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}+\frac {i c d}{f a \left (\tan \left (f x +e \right )-i\right )}+\frac {c^{2}}{2 f a \left (\tan \left (f x +e \right )-i\right )}-\frac {d^{2}}{2 f a \left (\tan \left (f x +e \right )-i\right )}\) | \(145\) |
default | \(-\frac {i c d \arctan \left (\tan \left (f x +e \right )\right )}{f a}+\frac {c^{2} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}-\frac {i d^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f a}+\frac {d^{2} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}+\frac {i c d}{f a \left (\tan \left (f x +e \right )-i\right )}+\frac {c^{2}}{2 f a \left (\tan \left (f x +e \right )-i\right )}-\frac {d^{2}}{2 f a \left (\tan \left (f x +e \right )-i\right )}\) | \(145\) |
[In]
[Out]
none
Time = 0.25 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.12 \[ \int \frac {(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx=\frac {{\left (2 \, {\left (c^{2} - 2 i \, c d + 3 \, d^{2}\right )} f x e^{\left (2 i \, f x + 2 i \, e\right )} + 4 i \, d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + i \, c^{2} - 2 \, c d - i \, d^{2}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{4 \, a f} \]
[In]
[Out]
Time = 0.24 (sec) , antiderivative size = 170, normalized size of antiderivative = 2.27 \[ \int \frac {(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx=\begin {cases} \frac {\left (i c^{2} - 2 c d - i d^{2}\right ) e^{- 2 i e} e^{- 2 i f x}}{4 a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (- \frac {c^{2} - 2 i c d + 3 d^{2}}{2 a} + \frac {\left (c^{2} e^{2 i e} + c^{2} - 2 i c d e^{2 i e} + 2 i c d + 3 d^{2} e^{2 i e} - d^{2}\right ) e^{- 2 i e}}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {i d^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} + \frac {x \left (c^{2} - 2 i c d + 3 d^{2}\right )}{2 a} \]
[In]
[Out]
Exception generated. \[ \int \frac {(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx=\text {Exception raised: RuntimeError} \]
[In]
[Out]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 123 vs. \(2 (61) = 122\).
Time = 0.48 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.64 \[ \int \frac {(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx=-\frac {\frac {{\left (-i \, c^{2} - 2 \, c d + i \, d^{2}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a} + \frac {{\left (i \, c^{2} + 2 \, c d + 3 i \, d^{2}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a} + \frac {-i \, c^{2} \tan \left (f x + e\right ) - 2 \, c d \tan \left (f x + e\right ) - 3 i \, d^{2} \tan \left (f x + e\right ) - 3 \, c^{2} - 2 i \, c d - d^{2}}{a {\left (\tan \left (f x + e\right ) - i\right )}}}{4 \, f} \]
[In]
[Out]
Time = 6.20 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.49 \[ \int \frac {(c+d \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx=-\frac {\frac {c\,d}{a}-\frac {c^2\,1{}\mathrm {i}}{2\,a}+\frac {d^2\,1{}\mathrm {i}}{2\,a}}{f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (c^2-c\,d\,2{}\mathrm {i}+3\,d^2\right )\,1{}\mathrm {i}}{4\,a\,f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (c^2\,1{}\mathrm {i}+2\,c\,d-d^2\,1{}\mathrm {i}\right )}{4\,a\,f} \]
[In]
[Out]